package arrays;

public class UniqueNo {
	int a[]={11,0,8,9,-3,6,12,12,-5,1,2,9,4,8,4};
	int tmp;
	boolean duplicate;
	
public void frequency()
	{ System.out.println("Array={11,0,8,9,-3,6,12,12,-5,1,2,9,4,8,4}");
		for(int i=0;i<a.length;i++)
			{
			  int freq=0;
			 	for(int j=0;j<a.length;j++)
				  {                                                  
					 if(a[i]==a[j])
					 freq++;
					              
	                }
			 	System.out.println("a["+i+"]= "+a[i] +" frequency= "+freq); 
			}
	}

public void unique()
    {
	System.out.println("printing distinct elements of Array");
	    for (int i=0;i< a.length;i++)
            {
               boolean duplicate = false;
               for (int j=0;j<i;j++)
                  {
                     if (a[i] == a[j]) 
                       {
                         duplicate = true;
                          break;
                       }
                   }//end of inner loop
                 if (!duplicate)
                 System.out.print(a[i]+" ");
                 
            }
    }
                             
            
                 
}
